package com.paxcodi.sockets.helloworld;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class SimpleServer {

    /**
     * @param args unused
     */
    public static void main(String[] args) {
	try {
	    ServerSocket serverSocket = new ServerSocket(0);
	    String hostName = "" + serverSocket.getInetAddress();
	    int portNumber = serverSocket.getLocalPort();
	    System.out.println("server connection data:\naddress: " +  
		    hostName + "\nport: " + portNumber);
	    while(true){
		Socket localSocket = serverSocket.accept();
		ServiceHandler handler = new ServiceHandler(localSocket);
	    }
	} catch (IOException e) {
	    // TODO Auto-generated catch block
	    e.printStackTrace();
	} //pick any port
	

    }

}
